<?php
require_once("link.php");


class SkillFind{
	private $nenufish_skillfind_id;
	private $nenufish_skillfind_title;
	private $nenufish_skillfind_editor;
	private $nenufish_skillfind_type;
	private $nenufish_skillfind_payType;
	private $nenufish_skillfind_content;
	private $nenufish_skillfind_pay;
	private $nenufish_skillfind_time;  //技能查找有效时间
	private $nenufish_skillfind_datatime;


	/*
     * 查询函数
     * 根据id查询所有信息
     */
	public function getAllById($nenufish_skillfind_id){
		$conn = new conn("123.207.114.241:3306","root","root","db_nenufish");
		$link = $conn->connection();
		$sql = "SELECT * FROM db_nenufish_skillfind WHERE nenufish_skillfind_id = ".$nenufish_skillfind_id;
		$query = mysqli_query($link,$sql) ;
		return $query;
	}

	/*
     * 查询函数
     * 查询所有状态为0的信息
     */
	public function getAll(){
		$conn = new conn("123.207.114.241:3306","root","root","db_nenufish");
		$link = $conn->connection();
		$sql = "SELECT nenufish_skillFind_id,nenufish_skillFind_title,nenufish_skillFind_datatime,nenufish_skillFind_content FROM db_nenufish_skillfind WHERE nenufish_skillfind_xstate = 0";
		//echo $sql;
		
		$query = mysqli_query($link,$sql) ;
		return $query;
	}

	/*
     * 查询函数
     * 根据type查询所有信息
     */
	public function getAllByType($nenufish_skillfind_type){
		 $conn = new conn("123.207.114.241:3306","root","root","db_nenufish");
	 	 $link = $conn->connection();
		 $sql = "SELECT * FROM db_nenufish_skillfind WHERE nenufish_skillfind_id = ".$nenufish_skillfind_type;
		 $query = mysqli_query($link,$sql) ;
		 return $query;
	}

	/*
     * 插入函数
     * 插入所有信息
     */
	public function insert($nenufish_skillfind_title,$nenufish_skillfind_editor,$nenufish_skillfind_type,$nenufish_skillfind_payType,$nenufish_skillfind_content,$nenufish_skillfind_pay,$nenufish_skillfind_time,$nenufish_skillfind_phone,$nenufish_skillfind_qq,$nenufish_skillfind_datatime){
		 $conn = new conn("123.207.114.241:3306","root","root","db_nenufish");
		 $link = $conn->connection();
		 $sql = "INSERT INTO db_nenufish_skillfind(nenufish_skillfind_title,nenufish_skillfind_editor,nenufish_skillfind_type,nenufish_skillfind_payType,nenufish_skillfind_content,nenufish_skillfind_pay,nenufish_skillfind_time,nenufish_skillfind_phone,nenufish_skillfind_qq,nenufish_skillfind_datatime) VALUES ('".$nenufish_skillfind_title."','".$nenufish_skillfind_editor."','".$nenufish_skillfind_type."','".$nenufish_skillfind_payType."','".$nenufish_skillfind_content."','".$nenufish_skillfind_pay."','".$nenufish_skillfind_time."','".$nenufish_skillfind_phone."','".$nenufish_skillfind_qq."','".$nenufish_skillfind_datatime."')";
		 //echo $sql;
		 $query = mysqli_query($link,$sql);
		 return $query;
	}

	/*
     * 删除函数
     * 根据ID删除信息
     */
	public function delete($nenufish_skillfind_id){
		 $conn = new conn("123.207.114.241:3306","root","root","db_nenufish");
		 $link = $conn->connection();
		 $sql = "DELETE FROM db_nenufish_skillfind WHERE nenufish_skillfind_id=".$nenufish_skillfind_id;
		 $query = mysqli_query($link,$sql) ;
		 return $query;
	}

	/*
     * 修改函数
     * 根据ID修改状态
     */
	public function updateState($nenufish_task_id,$nenufish_task_state){
		 $conn = new conn("123.207.114.241:3306","root","root","db_nenufish");
		 $link = $conn->connection();
		 $sql = "UPDATE db_nenufish_task SET nenufish_task_state='".$nenufish_task_state."' WHRER nenufish_task_id=".$nenufish_task_id;
		 $query = mysqli_query($link,$sql) ;
		 return $query;
	}
}
?>